import type { IRespose } from "@/api/type";
import type { IGood } from "@/types/index";
import api from "@/api/api";
export const goodDetail = (param: object): Promise<IGood> => {
  return api.post("Goods/quanDetail", param);
};

export const goodTui = (): Promise<IRespose> => {
  return api.post("Goods/quan_tui", { cid: "" });
};

export const getOrder = (params: object): Promise<IRespose> => {
  return api.post("Goods/orderNumNew", params);
};

export const getOrderList = (params: object): Promise<IRespose> => {
  return api.post("Goods/orderLog", params);
};

export const getGoodList = (params: object): Promise<IRespose> => {
  return api.post("Goods/goods", params);
};

export const productDetail = (params: object): Promise<IRespose> => {
  return api.post("Goods/goodsDetail", params);
};

export const productRecord = (params: object): Promise<IRespose> => {
  return api.post("Goods/goodsLog", params);
};

export const apply = (params: object): Promise<IRespose> => {
  return api.post("Goods/apply", params);
};

export const orderDetail = (params: object): Promise<IRespose> => {
  return api.post("Goods/orderDetail", params);
};

export const orderUpdate = (params: object): Promise<IRespose> => {
  return api.post("Goods/orderUpdate", params);
};

export const keyWord = (params: object): Promise<IRespose> => {
  return api.post('Goods/keyword', params)
}

export const uploadFile = (url: string, file: any): any => {
  console.log(file.get("level_image"), "file");
  file.append("m", "2020jksy");
  const config = {
    headers: { "Content-Type": "multipart/form-data" },
  };

  return api.post(url, file, config);
};
